Conversation
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
…dling Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] add syntax validation endoint
Add FML syntax validation endpoint with detailed error reporting
Sep 29, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR implements a comprehensive FML (FHIR Mapping Language) syntax validation endpoint with detailed error reporting. The implementation adds syntax validation capabilities to the core library and exposes them through REST API and MCP interfaces, providing developers with precise error messages including line and column information for debugging FML content.
Key changes implemented:
- Added syntax validation with detailed error detection and warning system
- Implemented REST API endpoint
/api/v1/fml/validate-syntaxwith FHIR-compliant responses - Added MCP tool
validate-fml-syntaxfor programmatic integration
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/fmlrunner/src/types/index.ts | Added type definitions for syntax validation results, errors, and warnings |
| packages/fmlrunner/src/lib/fml-compiler.ts | Implemented core syntax validation logic with comprehensive error detection |
| packages/fmlrunner/src/index.ts | Added validateFmlSyntax method to main FmlRunner class |
| packages/fmlrunner-rest/src/api.ts | Added REST endpoint for FML syntax validation with FHIR OperationOutcome responses |
| packages/fmlrunner-mcp/src/index.ts | Added MCP tool for syntax validation with JSON schema validation |
| packages/fmlrunner/tests/fml-syntax-validation.test.ts | Comprehensive test suite covering all validation scenarios |
| packages/fmlrunner-rest/tests/fml-syntax-validation-api.test.ts | REST API test suite with HTTP response validation |
| packages/fmlrunner/tsconfig.json | Updated TypeScript configuration to exclude specific files |
| docs/FML_SYNTAX_VALIDATION.md | Complete documentation for the new validation features |
| demo.html | Interactive demonstration page showing validation examples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements comprehensive FML (FHIR Mapping Language) syntax validation endpoint as requested in the issue. This provides developers with detailed syntax error messages including line and column information for debugging FML content without requiring full compilation.
Implementation
The syntax validation leverages the existing FML tokenizer and parser infrastructure from the codebase to provide comprehensive validation with detailed error reporting:
Core Library (
packages/fmlrunner)FmlSyntaxValidationResult,FmlSyntaxError, andFmlSyntaxWarningtypesvalidateSyntax()method inFmlCompilerclass with comprehensive error detectionvalidateFmlSyntax()method to mainFmlRunnerclassREST API (
packages/fmlrunner-rest)POST /api/v1/fml/validate-syntaxendpointMCP Interface (
packages/fmlrunner-mcp)validate-fml-syntaxtool with JSON schema validationFeatures
Detailed Error Detection:
{}and parentheses()detectionAdvanced Features:
//) and multi-line (/* */) commentsMultiple Interfaces:
Examples
Valid FML Response
{ "resourceType": "OperationOutcome", "issue": [{ "severity": "information", "code": "informational", "diagnostics": "FML syntax is valid" }] }Invalid FML Response
{ "resourceType": "OperationOutcome", "issue": [{ "severity": "error", "code": "invalid", "diagnostics": "FML content must start with a map declaration", "location": ["line 1, column 1"] }] }Testing
Comprehensive test coverage ensures reliability:
All tests verify error detection, warning generation, line/column reporting, and proper handling of edge cases including comments, empty content, and malformed syntax.
The implementation provides exactly what was requested in the issue: "useful error messages when failed" with precise location information to help developers debug their FML syntax issues.
Fixes #[issue_number]
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
scarf.shnode ./report.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.